CM_Get_DevNode_Property (cfgmgr32) 2 (cfgmgr32)
Last changed: -37.204.179.77

.
Summary
Retrieves a device instance property.

C# Signature:

[DllImport("CfgMgr32.dll", CharSet = CharSet.Unicode)]
static extern uint CM_Get_DevNode_Property(
    IntPtr dnDevInst,
    ref DEVPROPKEY PropertyKey,
    out uint PropertyType,
    IntPtr PropertyBuffer,
    ref uint PropertyBufferSize,
    uint ulFlags);

Macros:

static void DEFINE_DEVPROPKEY(out DEVPROPKEY key, UInt32 l, UInt16 w1, UInt16 w2, Byte b1, Byte b2, Byte b3, Byte b4, Byte b5, Byte b6, Byte b7, Byte b8, uint pid)
{
    key.fmtid = new Guid(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8);
    key.pid = pid;
}

User-Defined Types:

struct DEVPROPKEY
{
    public Guid fmtid;
    public uint pid;
}

Tips & Tricks:

Property Keys are defined in devpkey.h (https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/shared/devpkey.h)

Sample Code:

Documentation